entry: use priv->dnd_position when rendering the DND cursor
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 7 Mar 2014 00:19:50 +0000 (01:19 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 7 Mar 2014 03:54:46 +0000 (22:54 -0500)
This makes "cursor position" track the DnD point again, looks much
more intuitive than just rendering it on the pre-DnD position.

https://bugzilla.gnome.org/show_bug.cgi?id=725866

gtk/gtkentry.c

index b74ea4e0ab35ee223236ddaccc41c80d4a7ec415..a433426067239f12d8bde332e1c8599026b5a916 100644 (file)
@@ -6436,9 +6436,13 @@ gtk_entry_draw_cursor (GtkEntry  *entry,
 
   layout = gtk_entry_ensure_layout (entry, TRUE);
   text = pango_layout_get_text (layout);
-  cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
   get_layout_position (entry, &x, &y);
 
+  if (type == CURSOR_DND)
+    cursor_index = g_utf8_offset_to_pointer (text, priv->dnd_position) - text;
+  else
+    cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
+
   if (!priv->overwrite_mode)
     block = FALSE;
   else